/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.inventory.service;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.inventory.dao.ZlmtAccessoryStoreDao;
import com.thinkgem.jeesite.modules.inventory.entity.ZlmtAccessoryInout;
import com.thinkgem.jeesite.modules.inventory.entity.ZlmtAccessoryStore;
import com.thinkgem.jeesite.modules.inventory.entity.ZlmtHostsAccessory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 备件Service
 * @author johnKee
 * @version 2016-07-28
 */
@Service
@Transactional(readOnly = true)
public class ZlmtAccessoryStoreService extends CrudService<ZlmtAccessoryStoreDao, ZlmtAccessoryStore> {

	@Autowired
	private ZlmtAccessoryInoutService zlmtAccessoryInoutService;

	@Autowired
	private ZlmtHostsAccessoryService zlmtHostsAccessoryService;

	public ZlmtAccessoryStore get(String id) {
		return super.get(id);
	}
	
	public List<ZlmtAccessoryStore> findList(ZlmtAccessoryStore zlmtAccessoryStore) {
		return super.findList(zlmtAccessoryStore);
	}
	
	public Page<ZlmtAccessoryStore> findPage(Page<ZlmtAccessoryStore> page, ZlmtAccessoryStore zlmtAccessoryStore) {
		return super.findPage(page, zlmtAccessoryStore);
	}
	
	@Transactional(readOnly = false)
	public void save(ZlmtAccessoryStore zlmtAccessoryStore) {
		super.save(zlmtAccessoryStore);
	}
	
	@Transactional(readOnly = false)
	public void delete(ZlmtAccessoryStore zlmtAccessoryStore) {
		super.delete(zlmtAccessoryStore);
	}

	@Transactional(readOnly = false)
	public void groupSave(ZlmtAccessoryStore zlmtAccessoryStore, ZlmtAccessoryInout inout, ZlmtHostsAccessory zlmtHostsAccessory) {
		if(zlmtAccessoryStore != null) {
			super.save(zlmtAccessoryStore);
		}
		if(inout != null) {
			zlmtAccessoryInoutService.save(inout);
		}
		if(zlmtHostsAccessory != null){
			zlmtHostsAccessoryService.save(zlmtHostsAccessory);
		}
	}
}